static int i=0;
int main()
{
    unsigned n;
    printf("Please enter the number of discs:");
    scanf ("%d",&n);
    printf("\tneedle:\ta\tb\tc\n");
    mo(n,'a','c','b');
    printf("\tTotal:%d\n",i);
    return 0;
}
mo(n,fromneedle,toneedle,usingneedle)
unsigned int n;char fromneedle;char toneedle;char usingneedle;
{
    if(n>0)
    {
        mo(n-1,fromneedle,usingneedle,toneedle);
        ++i;
        switch(fromneedle)
        {
            case 'a':switch(toneedle)
            {
                case 'b':printf("\t[%d]:\t%2d----->%2d\n",i,n,n);
                    break;
                case 'c':printf("\t[%d]:\t%2d------------>%2d\n",i,n,n);
                    break;
            }
                break;
            case 'b':switch(toneedle)
            {
                case 'a':printf("\t[%d]:\t%2d<-----------%2d\n",i,n,n);
                    break;
                case 'c':printf("\t[%d]:\t\t%2d----->%2d\n",i,n,n);
                    break;
            }
                break;
            case 'c':switch(toneedle)
            {
                case 'a':printf("\t[%d]:\t%2d<-----------%2d\n",i,n,n);
                    break;
                case 'b':printf("\t[%d]:\t\t%2d<-----%2d\n",i,n,n);
                    break;
            }
                break;
        }
        mo(n-1,usingneedle,toneedle,fromneedle);
    }
    return 0;
}
